Skip to content

ISSUE-808 # Expose the executor's real error message on failed Java method invocation - #809

Merged
authorjapps merged 1 commit into
authorjapps:masterfrom
TianHengZhuang:issue-808-java-method-cause
Nov 11, 2026
Merged

authorjapps merged 1 commit into
authorjapps:masterfrom
TianHengZhuang:issue-808-java-method-cause

Conversation

@TianHengZhuang

Copy link
Copy Markdown
Contributor

Fixes #808

When a custom Java Executor/Answerer method throws, the real error was hidden behind InvocationTargetException. The log, the step report message and the JUnit failure message only said Java exec(): Invocation failed for method X in class Y — the executor's own message (e.g. Could not get OAuth2 token: ...) was buried in the console stack trace.

JavaMethodExecutorImpl.executeWithParams now catches InvocationTargetException separately:

  • appends the target exception to the message (... Cause: java.lang.IllegalArgumentException: Could not get OAuth2 token: ...);
  • logs the target exception's full stack trace via the logger;
  • keeps the message prefix and the exception cause chain unchanged.

Test: extended willPropagateExceptions to assert the message now carries Cause: java.lang.RuntimeException: Can not square root a negative number.

@authorjapps
authorjapps merged commit c8e931f into authorjapps:master Nov 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Java method step failures hide the real error behind InvocationTargetException

2 participants